<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWithdrawLogsTable extends Migration
{
    const TABLE_NAME = 'withdraw_logs';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(self::TABLE_NAME, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->char('openid', 64)->default('')->comment('openid');
            $table->tinyInteger('status', 0)->default(0)->comment('1-已申请已提交，2-通过并发放，3-拒绝');
            $table->decimal('amount', 12, 2)->default(0)->comment('1-图片,2-视频');
            $table->dateTime('created_at')->nullable();
            $table->dateTime('updated_at')->nullable();
            $table->dateTime('deleted_at')->nullable();
            $table->index(['openid' ,'status']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if (Schema::hasTable(self::TABLE_NAME)) {
            Schema::drop(self::TABLE_NAME);
        }
    }
}
